<?php
	echo "<h2 id='contentTitle'>".$pageTitle."</h2>";
	echo $this->renderElement('message');

	echo $html->link('Cadastrar user', '/users/add/');
	echo "<br /><br />";

	pr($users);
	
	if (isset($users) && is_array($users) && (!empty($users))) {
		echo "<table>";
		echo "<tr class='sort'>";
			echo "<th>Name</th>";
			echo "<th>Email</th>";
			echo "<th>Last_visit</th>";
			echo "<th>Editar</th>";
			echo "<th>Excluir</th>";
		echo "</tr>";

		$i=0;
		foreach ($users as $user) {
			if (($i++ % 2) == 1) $zebrado = " class='oddTr' ";
			else $zebrado = "";
			echo "<tr ".$zebrado.">";
			echo "<td>".$user['User']['name']."</td>";
			echo "<td>".$user['User']['email']."</td>";
			echo "<td>".$user['User']['last_visit']."</td>";
			echo "<td>".html_entity_decode($html->link($html->image('fileedit.png',array('class'=>'opIcon')), '/users/edit/'.$user['User']['id']))."</td>";
			echo "<td>".html_entity_decode($html->link($html->image('filedel.png',array('class'=>'opIcon')), '/users/delete/'.$user['User']['id'], array(), 'Confirma a exclusão deste item?'))."</td>";
			echo "</tr>";
		}
		echo "<tr id='footerTable'><td colspan='100%'></td></tr>";
		echo "</table>";
	}
